package com.base.self.vos;

import cn.hutool.http.HttpRequest;
import com.base.comm.CommUrls;
import com.beust.jcommander.internal.Maps;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;
import java.util.Map;

@Slf4j
@Component
public class SMSSendUtils {
    private static final String GET_URL = "http://47.111.98.25:7862/sms";
    private final static String account = "420065";
    private final static String password = "J3PRzf";
    private final static String extno = "10690889147";//接入码
    private final static String rt = "json";//xml/json

    public static void main(String[] args) {
        send();
    }
    public static void send(){
        try {
            Map<String, Object> map = Maps.newHashMap();
            map.put("account", account);
            map.put("password", password);
            map.put("mobile", "17674612951");
            map.put("extno",extno);
            map.put("action","send");
            map.put("rt",rt);
            map.put("content", URLEncoder.encode("【zh】尊敬的用户您好:,如非本人操作,请忽略本短信", "UTF-8"));
            final String body = HttpRequest
                    .get(GET_URL)
                    .form(map)
                    .execute()
                    .body();
            log.warn(body);
        } catch (UnsupportedEncodingException e) {
            e.printStackTrace();
        }
    }
}
